//
//  RHLocalBatteryClusterChartCell.m
//  RuiHeAppApp
//
//  Created by Yan Chen on 2024/4/29.
//

#import "RHLocalBatteryClusterChartCell.h"
#import "RHLocalBatteryClusterChartView.h"
#import "RHLocalCellRealDataModel.h"

@interface RHLocalBatteryClusterChartCell()

@property (nonatomic, strong) RHLocalBatteryClusterChartView *chartView;

@end

@implementation RHLocalBatteryClusterChartCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]){
        [self setupUI];
    }
    return self;
}

- (void)setChartModel:(RHLocalCellRealDataModel *)chartModel{
    _chartModel = chartModel;

    [_chartView setChartModel:_chartModel];
}


-(void)setupUI
{
    self.contentView.backgroundColor = CFTabViewBgColor;
    UIView *bgView = [[UIView alloc] init];
    [bgView.layer setCornerRadius:8];
    bgView.layer.masksToBounds = YES;
    [bgView setBackgroundColor:UIColor.whiteColor];
    [self.contentView addSubview:bgView];
    
    
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.insets(UIEdgeInsetsMake(0, 15, 0, 15));
    }];
    
    _chartView = [[RHLocalBatteryClusterChartView alloc] initWithFrame:CGRectMake(5, 5,SCREEN_WIDTH-40, 250+130) isLandscape:NO];
    [bgView addSubview:_chartView];
   
    
  
    [_chartView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.insets(UIEdgeInsetsMake(0, 0, 0, 0));
       
    }];
}

@end
